// 蜂窝蜜造平台生成代码，如手工更改，请添加到 .beeignore 忽略生成

package com.fowo.api.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fowo.api.entity.IssuOrder;
import com.fowo.api.entity.NavSellOrder;
import com.fowo.api.entity.OrderPicking;
import com.fowo.api.model.issu.order.IssuOrderVo;
import com.fowo.api.model.nav.sell.order.NavSellOrderVo;
import com.fowo.api.service.OrderPickingService;
import com.fowo.api.sys.annotation.DataActivity;
import com.fowo.api.sys.entity.SysBase;
import com.fowo.api.sys.entity.enums.SysDataActivityAction;
import com.fowo.api.user.model.JwtUserInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 订单管理打单拣货 服务实现类
 *
 * @author 蜂窝蜜造平台 配置人：汤帅杰，任凯
 */
@Service
@Slf4j
@DS("ds24")
public class OrderPickingServiceImpl
        extends OrderPickingBaseServiceImpl
        implements OrderPickingService {
    @Resource
    private NavSellOrderServiceImpl navSellOrderService;
    /**
     * 打单拣货发货
     */
    @DataActivity(action = SysDataActivityAction.Other, message = "%s执行了发货操作")
    @Override
    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
    public void finalDeliver(List<Long> ids) throws Exception {
        navSellOrderService.deliver(ids);
    }


    /**
     * 截单
     */
    @DataActivity(
            action = SysDataActivityAction.Other,
            message = "%s执行了截单操作"
    )
    @Override
    public void cut(List<Long> ids) throws Exception {
        navSellOrderService.cut(ids);
    }
}
